<!doctype html>
<html>
<head>
    <include file="public/head"/>
    <title>微信公众号-添加/编辑自定义回复</title>
    <meta name="description" content="ThinkCMF微信公众号插件">
    <meta name="keywords" content="ThinkCMF微信公众号插件">
    <style>
        .form-required {
            color: red;
        }
    </style>
</head>
<body>
<div class="wrap js-check-wrap">
    <div class="common-form">
        <form class="form-horizontal js-ajax-form margin-top-20" role="form" action="{:cmf_plugin_url('Wechat://AdminIndex/replyPost')}" method="post">
            <fieldset>
                <div class="tabbable">
                    <div class="tab-content">
                        <div class="tab-pane active">
                            <div class="form-group">
                                <label for="input-key" class="col-sm-2 control-label">关键词</label>
                                <div class="col-md-6 col-sm-10">
                                    <input type="text" class="form-control" id="input-key" name="key" value="{$reply.key|default=''}">
                                    <p class="help-block">
                                        如果是关注回复消息，关键词一栏请填写subscribe
                                    </p>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="input-type" class="col-sm-2 control-label"><span class="form-required">*</span>类型</label>
                                <div class="col-md-6 col-sm-10">
                                    <select class="form-control" name="type" id="input-type">
                                        <php>
                                            $reply['type'] = isset($reply['type']) ? $reply['type'] : 1;
                                            $news_selected = $reply['type'] == 1 ? "selected" : "";
                                            $text_selected = $reply['type'] == 2 ? "selected" : "";
                                        </php>
                                        <option value="1" {$news_selected}>图文消息</option>
                                        <option value="2" {$text_selected}>文本消息</option>
                                    </select>
                                    <p class="help-block">
                                        同一个关键词的图文消息最多添加8条。
                                    </p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="input-title" class="col-sm-2 control-label">标题</label>
                                <div class="col-md-6 col-sm-10">
                                    <input type="text" class="form-control" id="input-title" name="title" value="{$reply.title|default=''}">
                                    <p class="help-block">
                                       如果是文本消息，此栏内容就是要回复的内容；且只需要填写此栏<br>如果是图文消息，此栏内容是图文消息的标题。
                                    </p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="textarea-description" class="col-sm-2 control-label">描述</label>
                                <div class="col-md-6 col-sm-10">
                                    <textarea class="form-control" id="textarea-description" name="description">{$reply.description|default=''}</textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="picture" class="col-sm-2 control-label">图片</label>
                                <div class="col-md-6 col-sm-10">
                                    <input type="hidden" name="picture" id="picture" value="{$reply.picture|default=''}">
                                    <a href="javascript:uploadOneImage('图片上传','#picture');">
                                        <php>
                                            $picture = isset($reply['picture']) ? cmf_get_image_url($reply['picture']) : "/themes/admin_simpleboot3/public/assets/images/default-thumbnail.png";
                                        </php>
                                        <img src="{$picture}" id="picture-preview" width="135" style="cursor: pointer"/>
                                    </a>
                                    <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                                </div>
                            </div>
                            <script>
                                $('.btn-cancel-thumbnail').click(function () {
                                    $('#picture-preview').attr('src', '/themes/admin_simpleboot3/public/assets/images/default-thumbnail.png');
                                    $('#picture').val('');
                                });
                            </script>
                            <div class="form-group">
                                <label for="input-url" class="col-sm-2 control-label">跳转链接</label>
                                <div class="col-md-6 col-sm-10">
                                    <input type="text" class="form-control" id="input-url" name="url" value="{$reply.url|default=''}">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">状态</label>
                                <div class="col-md-6 col-sm-10">
                                    <label class="radio-inline">
                                        <php>$reply['status'] = isset($reply['status']) ? $reply['status'] : '1';</php>
                                        <php>$active_true_checked=($reply['status']==1)?"checked":"";</php>
                                        <input type="radio" name="status" value="1" {$active_true_checked}> {:lang('ENABLED')}
                                    </label>
                                    <label class="radio-inline">
                                        <php>$active_false_checked=($reply['status']==0)?"checked":"";</php>
                                        <input type="radio" name="status" value="0" {$active_false_checked}> {:lang('DISABLED')}
                                    </label>
                                </div>
                            </div>
                            <input type="hidden" name="id" value="{$reply.id|default=''}">
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <button type="submit" class="btn btn-primary js-ajax-submit" data-refresh="1">{:lang('SAVE')}</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>
        </form>
        <script type="text/javascript" src="__STATIC__/js/admin.js"></script>
    </div>
</div>
<include file="public/scripts"/>
</body>
</html>